import request from "@/utils/request";
import type { CourseCategory, CourseCategoryListVO } from "./type";

const DEPT_BASE_URL = "/api/v1/course/category";

export const getList = () => {
  return request<any, CourseCategoryListVO[]>({
    url: `${DEPT_BASE_URL}/list`,
    method: "get",
  });
};

export const add = (data: CourseCategory) => {
  return request<any, boolean>({
    url: `${DEPT_BASE_URL}/add`,
    method: "post",
    data: data,
  });
};

export const update = (data: CourseCategory) => {
  return request<any, boolean>({
    url: `${DEPT_BASE_URL}/update`,
    method: "post",
    data: data,
  });
};

export const deleteByIds = (id: string) => {
  return request<any, boolean>({
    url: `${DEPT_BASE_URL}/delete/${id}`,
    method: "delete",
  });
};
